<template>
  <div class="contain">
    <detail-banner :sightname="sightname" :bannerImg="bannerImg" :gallaryImgs="gallaryImgs"></detail-banner>
    <detail-header></detail-header>
    <detail-evalute></detail-evalute>
    <detail-recommend :recommendList="recommendList"></detail-recommend>
    <detail-list :list="categoryList"></detail-list>
  </div>
</template>

<script>
import DetailBanner from './components/banner'
import DetailHeader from './components/header'
import DetailList from './components/list'
import DetailEvalute from './components/evalute'
import DetailRecommend from './components/recommend'
import axios from 'axios'
export default {
  name: 'detail',
  components: {
    DetailBanner,
    DetailHeader,
    DetailList,
    DetailEvalute,
    DetailRecommend
  },
  data () {
    return {
      sightname: '',
      bannerImg: '',
      gallaryImgs: [],
      categoryList: [],
      recommendList: []
    }
  },
  methods: {
    getDetailInfo () {
      axios.get('/api/detail.json', {
        params: {
          id: this.$route.params.id
        }
      }).then(this.handleGetDataSucc)
    },
    handleGetDataSucc (res) {
      res = res.data
      if (res.ret && res.data) {
        const data = res.data
        this.sightname = data.sightName
        this.bannerImg = data.bannerImg
        this.gallaryImgs = data.gallaryImgs
        this.categoryList = data.categoryList
        this.recommendList = data.recommendList
      }
    }
  },
  mounted () {
    this.getDetailInfo()
  }
}
</script>

<style lang="stylus" scoped>
  .contain
    background: #f5f5f5;
</style>
